import axios from '@/libs/api.request'

const prefix = '/web/trainer'
const trainerApi = {
  pageResult(trainCenter) {
    return axios.request({
      url: prefix + '/pageResult',
      data: trainCenter,
      method: 'post'
    })
  },
  saveOrUpdate(trainCenter) {
    return axios.request({
      url: prefix + "/saveOrUpdate",
      method: 'post',
      data: trainCenter
    })
  },
  unbind(trainCenterId, trainerId) {
    return axios.request({
      url: prefix + '/unbind/' + trainCenterId + "/" + trainerId,
      method: 'delete'
    })
  },
  userTrainCenterScope() {
    return axios.request({
      url: prefix + '/userTrainCenterScope',
      method: 'get'
    })
  },
  get(id) {
    return axios.request({
      url: prefix + '/' + id,
      method: 'get'
    })
  },
  updateTrainerCoach(trainCenterId, trainerId, coachIds) {
    return axios.request({
      url: prefix + '/trainerCoach',
      data: {'trainCenterId': trainCenterId, 'trainerId': trainerId, 'coachIds': coachIds},
      method: 'post'
    })
  },
  searchNotJoinedTrainers(data) {
    return axios.request({
      url: prefix + '/notJoinedTrainers/' + data['trainCenterId'],
      data: data,
      method: 'post'
    })
  },
  invite(trainCenterId, trainerId) {
    return axios.request({
      url: prefix + '/invite/' + trainCenterId + '/' + trainerId,
      method: 'post'
    })
  },
  getTrainerDetail(trainerId) {
    return axios.request({
      url: prefix + '/detail/' + trainerId,
      method: 'get'
    })
  },
}

export default trainerApi
